package DAO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import POJO.Deal;

@Repository
public class DealDao {
	@Autowired
	JdbcTemplate jdbcTemplate;
	
	public int save(Deal deal){
		String saveSql="INSERT INTO `log_paypackage` (`log_payPackage_userID`," +
				" `log_payPackage_branchID`, " +
				"`log_payPackage_expressID`, " +
				"`log_payPackage_packageID`, " +
				"`log_payPackage_money`, " +
				"`log_payPackage_channel`, " +
				"`log_payPackage_serialNum`," +
				" `log_payPackage_comment`, " +
				"`log_payPackage_status`, " +
				"`log_payPackage_balance`) VALUES (?,?,?,?,?,?,?,?,?,?);";
		Object[] params=new Object[]{deal.getUserId(),
									deal.getBranchId(),
									deal.getExpressId(),
									deal.getParcelId(),
									deal.getCost(),
									deal.getChannel(),
									deal.getSerialNum(),
									deal.getComment(),
									deal.getStatus(),
									deal.getBalance()};
		return jdbcTemplate.update(saveSql,params);
	}
}
